//
//  JZChargeResultDescpVC.m
//  JFTwxsd
//
//  Created by Peter on 2018/4/10.
//  Copyright © 2018年 junfeiweiyejiaoyujituan. All rights reserved.
//

#import "JZChargeResultDescpVC.h"

@interface JZChargeResultDescpVC ()

@property (weak, nonatomic) IBOutlet UIView *bottomView;
@property (weak, nonatomic) IBOutlet UIImageView *resultImg;
@property (weak, nonatomic) IBOutlet UILabel *resultDescpLab;
@property (weak, nonatomic) IBOutlet UILabel *resultLab;

@end

@implementation JZChargeResultDescpVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self configNav];
    [self configImg];
}

- (void)configNav {
   
    UIButton *chargeDetailBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    chargeDetailBtn.frame = CGRectMake(0, 0, 50, 45);
    [chargeDetailBtn setTitle:@"关闭" forState:UIControlStateNormal];
    [chargeDetailBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    chargeDetailBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
    [chargeDetailBtn addTarget:self action:@selector(chargeDetail) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithCustomView:chargeDetailBtn];
    self.navigationItem.rightBarButtonItem = rightBtn;
}

- (void)chargeDetail {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)configImg {
    _bottomView.layer.cornerRadius = 5;
    _bottomView.layer.borderWidth = 1;
   
    _bottomView.clipsToBounds = YES;
    
    NSArray *resultImage = @[@"charge_succ",@"charge_fail",@"charge_wait"];
    NSArray *resultText = @[@"充值成功",@"充值失败",@"充值中"];
    NSArray *resultDescp = @[@"您的订单已充值成功",@"您的订单未充值成功",@"您的订单已受理"];
    
    if ([_chargeResult isEqualToString:@"交易成功"]) {
        _resultImg.image = [UIImage imageNamed:resultImage[0]];
        _resultLab.text = resultText[0];
       
        _resultDescpLab.text = resultDescp[0];
    } else if ([_chargeResult isEqualToString:@"交易失败"]) {
        _resultImg.image = [UIImage imageNamed:resultImage[1]];
        _resultLab.text = resultText[1];
       
        _resultDescpLab.text = resultDescp[1];
    } else if ([_chargeResult isEqualToString:@"交易中"]) {
        _resultImg.image = [UIImage imageNamed:resultImage[2]];
        _resultLab.text = resultText[2];
        _resultDescpLab.text = resultDescp[2];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
